package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.sql.DataSource;

/**
 * @author stone
 * @date 2022/06/24 11:12
 */
@RestController
public class HelloController {

    @Autowired
    UserService userService;

    @RequestMapping("hello")
    public BaseRespVo hello() {
        return BaseRespVo.ok("hello sb");
    }

    @Autowired
    DataSource dataSource;

    // 查询user表中共有多少条记录
    @RequestMapping("user/count")
    public BaseRespVo userCount() {
        int count = userService.queryCount();
        return BaseRespVo.ok(count);
    }

}
